<!-- 成绩单管理详情-->
<template>
    <div class="scorddetail">
        <el-card>
            <el-form ref="form" :model="form" :disabled="true" label-width="80px" >
                <el-form-item label="学生姓名">
                    <el-input v-model="form.name"  style="width:200px"></el-input>
                </el-form-item>
                <el-form-item label="性别">
                  <el-select
                    v-model="form.sex"
                    placeholder="请选择性别"
                  >
                    <el-option
                      v-for="item in sexOptions"
                      :key="item.typeId"
                      :label="item.typeName"
                      :value="{value:item.typeId,label:item.typeName}"
                    >
                    </el-option>
                  </el-select>
                    <!-- <el-input v-model="form.sex"  style="width:200px">{{form.sex == 0 ? '女' : '男'}}</el-input> -->
                </el-form-item>
                <el-form-item label="学院">
                  <el-select
                      v-model="form.college"
                      clearable
                      placeholder="请选择院校"
                      ref="infoSelectUpResId"
                    >
                      <el-option hidden :value="form.college" :label="form.college">
                      </el-option>
                      <el-tree
                        :data="editSeletOptions"
                        :props="defaultProps"
                        :expand-on-click-node="false"
                        :check-on-click-node="true"
                      >
                      </el-tree>
                    </el-select>
                    <!-- <el-input v-model="form.college" style="width:200px"></el-input> -->
                </el-form-item>
                <el-form-item label="专业">
                  <el-select
                    v-model="form.major"
                    placeholder="请选择专业"
                  >
                    <el-option
                      v-for="item in editMajorOptions"
                      :key="item.majorId"
                      :label="item.majorName"
                      :value="{value:item.majorId,label:item.majorName}"
                    >
                    </el-option>
                  </el-select>
                    <!-- <el-input v-model="form.major" style="width:200px"></el-input> -->
                </el-form-item>
                <el-form-item label="班级">
                  <el-select
                    v-model="form.classes"
                    placeholder="请选择班级"
                  >
                    <el-option
                      v-for="item in classListData"
                      :key="item.classId"
                      :label="item.className"
                      :value="{value:item.classId,label:item.className}"
                    >
                    </el-option>
                  </el-select>
                    <!-- <el-input v-model="form.classes" style="width:200px"></el-input> -->
                </el-form-item>
                <el-form-item label="成绩">
                    <el-table :data="form.achievement" border style="width: 50%">
                        <el-table-column prop="subject" label="科目"> </el-table-column>
                        <el-table-column prop="fraction" label="分数"></el-table-column>
                        <el-table-column label="评分" prop="score"></el-table-column>
                        <el-table-column label="是否补考" prop="makeUp"></el-table-column>
                    </el-table>
                </el-form-item>
            </el-form>
        <el-button type="info" @click="$router.go(-1)">关闭</el-button>
        </el-card>

    </div>
</template>
<script>
import { getScoreListApi } from "@/api/achievement/studentscore";
import {
  colleageTreeDataApi,
  majorListApi,
  getClassGradeListApi,
  // getGradeListApi,
} from "@/api/graduation/thegraduate.js"
import {
getClassifyListApi
} from "@/api/basics/classify"
export default {
    data(){
        return{
            form:{},
            editMajorOptions:[],
            editSeletOptions:[],
            classListData:[],
            defaultProps:{
              children:"children",
              label:"label"
            },
            sexOptions:[]
        }
    },
    mounted(){
        console.log(this.$route.params.id);
        var id = this.$route.params.id
        getScoreListApi({id:id}).then(res=>{
            console.log(res,'成绩单详情');
            
            this.form = res.rows[0]
            console.log(this.form);
            this.form.sex = this.form.sex == '0' ? '男' : '女'
            console.log(this.form);
        })
        // this.editSelectTreeData()
        getClassifyListApi({parentId:39}).then(res=>{
          console.log(res);
          this.sexOptions = res.rows
        })
        
    },
    methods:{
      async getMajorIdClass(id) {
        const data = await getClassGradeListApi({majorId:id})
          this.classListData = data.rows
          console.log(data,'-------->班级');
          // this.getCourseData(id)

      },
      // 学院
      async editSelectTreeData() {
        const data = await colleageTreeDataApi();
        this.editSeletOptions = data.data;
      },
      async editSelectValueHandler(id) {
        console.log(id,'-----------');
        // console.log(id, "arr");
        const data = await majorListApi({ colleageName: id, status:'0'});
        console.log(data);
        this.editMajorOptions = data.rows;
      },
    }
}
</script>
<style lang="scss" scoped>
.scorddetail{
    width: 100%;
    padding: 10px;
}
</style>
